//
//  VideoDetailCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "VideoDetailCell.h"

@interface VideoDetailCell ()


@end

@implementation VideoDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        UIImageView *baseImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenIp6(40), kScreenIp6(20), kScreenWidth - kScreenIp6(40)*2, kScreenIp6(170))];
        baseImage.image = [UIImage imageNamed:@"header_bg_black@2x"];
        [self addSubview:baseImage];
        
        self.showImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenIp6(1), kScreenIp6(20), kScreenWidth - kScreenIp6(41)*2, kScreenIp6(130))];
        [baseImage addSubview:_showImage];
        
        self.length = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(baseImage.frame) - kScreenIp6(60), CGRectGetMaxY(baseImage.frame) - kScreenIp6(20), kScreenIp6(60), kScreenIp6(20))];
        self.length.font = [UIFont systemFontOfSize:13];
        self.length.textAlignment = 1;
        self.length.textColor = [UIColor whiteColor];
        [self addSubview:_length];
        
        self.title = [[UILabel alloc] initWithFrame:CGRectMake(kScreenIp6(40), CGRectGetMaxY(baseImage.frame), self.showImage.bounds.size.width, kScreenIp6(20))];
        self.title.font = [UIFont systemFontOfSize:14];
        [self addSubview:_title];
        
    }
    
    return self;
}


- (void)setModelWith:(JijinVideoDetailModel *)model
{
    [self.showImage setImageWithURL:[NSURL URLWithString:model.imgUrl] placeholderImage:[UIImage imageNamed:@"no_pic"]];
    
    
    self.length.text = model.blength;
    
    NSArray *nameArray = [model.name componentsSeparatedByString:@" "];
    self.title.text = [NSString stringWithFormat:@"%@ %@ %@ %@",nameArray[0], nameArray[2],nameArray[3],nameArray[4]];
}

@end
